package ink.openmind.threadexception;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author wangzhuangzhuang
 * @Description:
 * @date 2022-05-18 13:03
 */
public class ThreadExceptionDemoWithPrintException {

	public static void main(String[] args) {
		ExecutorService threadPool = Executors.newFixedThreadPool(5);
		for (int i = 0; i < 5; i++) {
			threadPool.submit(() -> {
				System.out.println("current thread name" + Thread.currentThread().getName());
				try {
					Object obj = null;
					System.out.println("result##" + obj.toString());
				} catch (Exception e) {
					System.out.println("程序出现异常！！！");
				}
			});
		}
	}
}

//  current thread namepool-1-thread-1
//  程序出现异常！！！
//  current thread namepool-1-thread-3
//  程序出现异常！！！
//  current thread namepool-1-thread-2
//  current thread namepool-1-thread-5
//  current thread namepool-1-thread-4
//  程序出现异常！！！
//  程序出现异常！！！
//  程序出现异常！！！